import request from '@/utils/request'

export interface categoryL1List {
  id: Number
  superCategoryId: Number
  showIndex: Number
  name: String
  frontName: null
  frontNameIcon: null
  frontDesc: null
  bannerUrl: null
  bannerList: null
  iconUrl: null
  imgUrl: null
  level: null
  subCateList: []
  wapBannerUrl: null
  type: Number
  wapExpandPicTargetUrl: null
  categoryType: Number
  extra: null
}

export interface cateGoryLis {
  currentCategory: bannerList5[]
  categoryL1List: categoryL1List[]
  categoryL2List: categoryL2List[]
}

export interface bannerList {
  materialContentFrom: number
  materialName: string
  rcmdSort: boolean
  taskType: number
  itemFrom: number
  crmUserGroupName: string
  resourcesId: number
  materialType: string
  crmUserGroupId: 0
  materialId: number
  taskId: number
}

export interface bannerList6 {
  id: string
  superCategoryId: number
  showIndex: number
  name: string
  frontName: null
  frontNameIcon: null
  frontDesc: null
  bannerUrl: string
  bannerList: null
  iconUrl: null
  imgUrl: null
  level: null
  subCateList: []
  wapBannerUrl: string
  type: 0
  wapExpandPicTargetUrl: null
  categoryType: number
  extra: bannerList[]
}

export interface bannerList {
  categoryGroupList: bannerList6
}

export interface categoryL2List {
  id: number
  superCategoryId: number
  showIndex: number
  name: string
  frontName: null
  frontNameIcon: null
  frontDesc: null
  bannerUrl: string
  bannerList: null
  iconUrl: null
  imgUrl: null
  level: null
  subCateList: []
  wapBannerUrl: string
  type: number
  wapExpandPicTargetUrl: null
  categoryType: number
  extra: categoryL2List1
}

export interface categoryL2List1 {
  materialContentFrom: number
  materialName: string
  rcmdSort: boolean
  taskType: number
  itemFrom: number
  crmUserGroupName: string
  resourcesId: number
  materialType: string
  crmUserGroupId: number
  materialId: number
  taskId: number
}

export const getcateGoryList = () => {
  return request.get<any, cateGoryLis>('/item/cateList.json')
}

export interface categoryGroupList {
  categoryGroupList: categoryGroupList1[]
  id: number
  name: string
  categoryList: categoryGroupList1[]
  currentCategory: bannerList5
}

export interface bannerList5 {
  id: number
  name: null
  currentCategory: bannerList6[]
  picUrl: string
  bannerList: getGoeryList[]
}

export interface getGoeryList {
  id: number
  pricUrl: string
  targetUrl: string
}

export interface categoryGroupList1 {
  id: number
  superCategoryId: number
  showIndex: number
  name: string
  frontName: string
  frontNameIcon: null
  frontDesc: string
  bannerUrl: null
  bannerList: null
  iconUrl: null
  imgUrl: null
  level: string
  subCateList: []
  wapBannerUrl: string
  type: number
  wapExpandPicTargetUrl: null
  categoryType: number
  extra: null
}

export interface categoryL2Li {
  category:category
  bannerList: null
  bannerUrl: string
  categoryType: 0
  extra: null
  frontDesc: string
  frontName: string
  frontNameIcon: null
  iconUrl: null
  id: number
  imgUrl: null
  level: string
  name: string
  showIndex: number
  subCateList: []
  superCategoryId: number
  type: number
  wapBannerUrl: string
  wapExpandPicTargetUrl: null
}

export interface itemList {
  category:any
  adBanners: null
  appExclusiveFlag: boolean
  appExclusivePrice: null
  appFreshmanBannerVO: null
  attrList: null
  auctionInfoVO: null
  autoOnsaleTime: number
  autoOnsaleTimeLeft: number
  banner: null
  bigPromotion: null
  bonusBanner: null
  brandInfo: null
  buttonType: number
  buyTitle: null
  categoryL2Id: number
  categoryList: null
  characteristicList: null
  colorNum: number
  commentCount: number
  commentWithPicCount: number
  comments: null
  counterPrice: number
  countryInfo: null
  couponConflict: true
  couponPrice: null
  couponShortNameList: null
  depositDetailVO: null
  detailPromBanner: null
  discountDesc: null
  displaySkuId: number
  extra: null
  extraPrice: string
  extraServiceFlag: number
  featuredSeries: null
  finalPriceInfoVO: finalPriceInfoVO
  flashPageLink: string
  forbidBuyDesc: null
  forbidExclusiveCal: false
  forbiddenBuy: false
  freeTryId: number
  freeTryVO: null
  freightInfo: null
  fullRefundPolicy: null
  goodCmtRate: null
  gradientPrice: null
  hdrkDetailVOList: null
  id: number
  isPreemption: number
  issueList: null
  itemDetail: null
  itemDiscountDetail: null
  itemLimit: null
  itemPromValid: true
  itemSizeTableDetailFlag: false
  itemSizeTableFlag: false
  itemSizeTableList: null
  itemTagList: itemTagList[]
  itemType: number
  jumpUrl: null
  layawayList: null
  limitedFlag: number
  listPicUrl: string
  listProPriceInfoDTO: null
  listPromBanner: null
  monthlySavingCard: null
  name: string
  newItemFlag: boolean
  noticeText: null
  onSaleTime: number
  picMode: number
  pieceNum: number
  pieceUnitDesc: string
  pointTag: null
  pointTagExtra: null
  pointTagPrefix: null
  points: number
  pointsPrice: number
  pointsStatus: number
  preLimitFlag: number
  preLogo: topLogo[]
  preemptionStatus: number
  presentUrl: null
  price: null
  primaryPicUrl: string
  primarySkuId: number
  primarySkuPreSellPrice: number
  primarySkuPreSellStatus: number
  proDiscount: null
  productPlace: string
  promDesc: null
  promId: number
  promLogo: null
  promTag: null
  promoTip: null
  promoTips: null
  promotionDesc: string
  purchaseMethodVO: null
  purchaseRate: null
  rank: number
  recommendReason: null
  relatedItemCommentTag: null
  remark: null
  reportPicList: null
  retailPrice: number
  rewardDesc: null
  rewardShareFlag: false
  saleCenterDesc: null
  saleCenterSkuId: number
  saleCenterSkuSpec: null
  scenePicUrl: string
  sellVolume: number
  seoTitle: string
  shieldSpecialChannel: false
  shoppingReward: null
  shoppingRewardRule: null
  showCommentEntrance: true
  showPoints: false
  showPrice: false
  showTime: number
  simpleBrandInfo: null
  simpleDesc: string
  skuFreight: null
  skuList: null
  skuMap: null
  skuSpecList: null
  sloganTip: null
  soldOut: false
  sortFlag: number
  sortOriginPrice: number
  source: number
  specialPromTag: string
  spmcBanner: null
  spmcFinalPriceBannerVO: null
  spmcFinalPriceCalcResultBean: null
  spmcOpenGiftItemDesc: null
  status: number
  subtractPriceDesc: null
  tagList: null
  topCommentVO: null
  topLogo: topLogo
  tryOutEventReport: null
  underShelf: boolean
  unitPrice: null
  updateTime: number
  valueReturnDesc: null
  wapSchemeUrl: null
  welfareCardVO: null
  zc: boolean
  zcSearchFlag: boolean
  zoomTransPicV2Url: string
}

export interface category {
  bannerList: null
  bannerUrl: string
  categoryType: string
  extra: null
  frontDesc: string
  frontName: string
  frontNameIcon: null
  iconUrl: null
  id: number
  imgUrl: null
  level: string
  name: string
  showIndex: number
  subCateList: []
  superCategoryId: number
  type: number
  wapBannerUrl: string
  wapExpandPicTargetUrl: null
}

export interface topLogo {
  logoUrl: string
  width: number
  height: number
  type: number
}

export interface itemTagList {
  forbidJump: boolean
  freshmanExclusive: boolean
  itemId: number
  name: string
  subType: number
  tagId: number
  type: number
}

export interface finalPriceInfoVO {
  banner: banner
  priceInfo: priceInfo
}
export interface banner{
  logo: null
  title: null
  price: null
  content: string
}

export interface priceInfo{
  basicPrice: null
  counterPrice: string
  finalPrice: finalPrice
}

export interface finalPrice {
  prefix: string
  price: string
  suffix: null
}

export interface itemList1{
  itemList:itemList[]
  category:category3
}

export interface category3{
  bannerList:null
  bannerUrl:string
  categoryType:string
  extra:null
  frontDesc:string
  frontName:string
  frontNameIcon:null
  iconUrl:null
  id:number
  imgUrl:null
  level:null
  name:string
  showIndex:string
  subCateList:[]
  superCategoryId:string
  type:number
  wapBannerUrl:string
  wapExpandPicTargetUrl:null
}

export interface extra{
  crmUserGroupId: "0"
  crmUserGroupName: "无分组"
  itemFrom:number
  materialContentFrom:number
  materialId:string
  materialName:string
  materialType:string
  rcmdSort:string
  resourcesId:number
  taskId:string
  taskType:number
}
export interface finalPrice1 {
  categoryItems: itemList1
  categoryL2List: categoryL2Li[]
}
export const getcateList = (id: number = 11) => {
  return request.get<any, categoryGroupList>(
    `/item/cateList.json?__timestamp=1630131455012&categoryId=${id}`
  )
}

export const getPagingData = (catygory: number, id: number) => {
  return request.get<any, finalPrice1>(
    `/item/list.json?categoryType=0&subCategoryId=${catygory}&categoryId=${id}`
  )
}
